package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class WriteStringDemo {
    public static void main(String[] args) throws IOException {
        //输入流
        FileOutputStream fos=new FileOutputStream("fos.txt");
        String line="爱入火，温暖了心窝";
        byte[] data=line.getBytes(StandardCharsets.UTF_8);//将line的内容按照utf-8的编码转换
        fos.write(data);//写入
        fos.write("你在笑疯狂的人是我".getBytes(StandardCharsets.UTF_8));
        System.out.println("写出完毕");
        fos.close();
    }
}
